<template>
  <d2-container>
    <div class="flex-1 mt-2 ml-2">
      <el-table :data="distriSubList" border stripe>
        <el-table-column align="center" label="序号" type="index" width="45" />
        <el-table-column align="center" label="用户名称" prop="user_name" width="95" />
        <el-table-column align="center" label="联系电话" prop="user_phone" width="95" />
        <el-table-column align="center" label="上级" prop="user_name" width="70">
          <template slot-scope="scope">
            <span v-if="scope.row.leader_nickname != null">{{ scope.row.leader_nickname }}</span>
            <span v-else>{{ scope.row.leader_name }}</span>
          </template>
        </el-table-column>
        <el-table-column align="center" label="推广用户数量" prop="total_subordinates" width="60" />
        <el-table-column align="center" label="邀请码" prop="mark_id" width="60" />
        <el-table-column align="center" label="可提现余额" prop="commission_amount" width="60" />
        <el-table-column align="center" label="佣金总金额" prop="total_commission" width="60" />
        <el-table-column align="center" label="已提现" prop="used_commission" width="60" />
      </el-table>
    </div>
  </d2-container>
</template>

<script>
  import {
    distributorsSubUrl
  } from '@/utils/distribution'
  export default {
    data() {
      return {
        getUserId:'',
        distriSubList:[],
        distriSubTotal:1
      }
    },
    mounted() {
      this.getUserId = this.$route.query.userId
      this.getDistributorsSub()
    },
    methods:{
      getDistributorsSub(){
        this.$get(distributorsSubUrl + this.getUserId + '/').then(res=>{
          this.distriSubList = res.data.data.list
          this.distriSubTotal = res.data.data.total
        })
      }
    }
  }
</script>

<style>
</style>
